package com.ruoyi.lm.main;


import com.ruoyi.common.utils.menu.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;



/**
 * 菜单管理器类
 * 
 * @author
 */
public class MenuManager {

	/**
	 * 组装菜单数据
	 * 
	 * @return
	 */
	private static Logger log = LoggerFactory.getLogger(MenuManager.class);
	public static Menu getMenu() {
//		ClickButton btn11 = new ClickButton();
//		btn11.setName("加盟介绍");
//		btn11.setType("click");
//		btn11.setKey("11");
		ViewButton wx11 = new ViewButton();
		wx11.setName("加盟介绍");
		wx11.setType("view");
		wx11.setUrl("https://www.zzzsyh.com/index.html#/joining");
		ViewButton wx12 = new ViewButton();
		wx12.setName("App下载");
		wx12.setType("view");
		wx12.setUrl("https://www.zzzsyh.com/index.html#/app");


		ComplexButton mainBtn3 = new ComplexButton();
		mainBtn3.setName("加盟登录");
		mainBtn3.setSub_button(new Button[] {wx11,wx12 });



		ViewButton wx = new ViewButton();
		wx.setName("一键下单");
		wx.setType("view");
		wx.setUrl("https://www.zzzsyh.com/index.html#/first");
		ViewButton wx2 = new ViewButton();
		wx2.setName("订单跟踪");
		wx2.setType("view");
		wx2.setUrl("https://www.zzzsyh.com/index.html#/order");
		ViewButton wx3 = new ViewButton();
		wx3.setName("个人中心");
		wx3.setType("view");
		wx3.setUrl("https://www.zzzsyh.com/index.html#/myzoe");
		ViewButton wx4 = new ViewButton();
		wx4.setName("识别配件");
		wx4.setType("view");
		wx4.setUrl("https://www.zzzsyh.com/index.html#/richscan");
		ComplexButton mainBtn1 = new ComplexButton();
		mainBtn1.setName("服务中心");
		mainBtn1.setSub_button(new Button[] {wx,wx2,wx3,wx4});


		ViewButton fjmd = new ViewButton();
		fjmd.setName("我的收益");
		fjmd.setType("view");
		fjmd.setUrl("https://www.zzzsyh.com/index.html#/onlyEarnings");

		/**
		 * 这是公众号目前的菜单结构，每个一级菜单都有二级菜单项<br>
		 * 
		 * 在某个一级菜单下没有二级菜单的情况，menu该如何定义呢？<br>
		 * 比如，第三个一级菜单项不是“更多体验”，而直接是“幽默笑话”，那么menu应该这样定义：<br>
		 * menu.setButton(new Button[] { mainBtn1, mainBtn2, btn33 });
		 */
		Menu menu = new Menu();
		menu.setButton(new Button[] { mainBtn1, fjmd, mainBtn3 });
		return menu;
	}

	public static void main(String[] args) {
		// 调用接口创建菜单
		boolean result = MenuUtil
				.createMenu(getMenu(), "36_vOsIXU1TbhPYqyGrlZHzueCBmRFU150mzD0QACBOx_TZLnHKBGE3zaasTzAwP1G6O9wgPVzG_TVXaiRalsgTudOCc8c3pO6ezcAbXcNBQ2XGChN0jlJMwdsGL7nLF1SrQvbfZ0nTAXynXUCGKYGcACARFN");

		// 判断菜单创建结果
		if (result)
			log.info("菜单创建成功！");
		else
			log.info("菜单创建失败，错误码：" + result);
	}

}
